package com.nulldev.util.data.Arrays.arrays;

import java.util.Collection;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.Spliterator;
import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.function.UnaryOperator;
import java.util.stream.Stream;

public class EmptyList<I> implements List<I> {

	@Override
	public int size() {
		return 0;
	}

	@Override
	public boolean isEmpty() {
		return true;
	}

	@Override
	public boolean contains(Object o) {
		return false;
	}

	@Override
	public Iterator<I> iterator() {
		return new Iterator<I>() {

			@Override
			public boolean hasNext() {
				return false;
			}

			@Override
			public I next() {
				return null;
			}
		};
	}

	@Override
	public Object[] toArray() {
		return new Object[0];
	}

	@Override
	public <T> T[] toArray(T[] a) {
		return a;
	}

	@Override
	public boolean add(I e) {
		return false;
	}

	@Override
	public boolean remove(Object o) {
		return false;
	}

	@Override
	public boolean containsAll(Collection<?> c) {
		return false;
	}

	@Override
	public boolean addAll(Collection<? extends I> c) {
		return false;
	}

	@Override
	public boolean addAll(int index, Collection<? extends I> c) {
		return false;
	}

	@Override
	public boolean removeAll(Collection<?> c) {
		return false;
	}

	@Override
	public boolean retainAll(Collection<?> c) {
		return false;
	}

	@Override
	public void clear() {
	}

	@Override
	public I get(int index) {
		return null;
	}

	@Override
	public I set(int index, I element) {
		return null;
	}

	@Override
	public void add(int index, I element) {
	}

	@Override
	public I remove(int index) {
		return null;
	}

	@Override
	public int indexOf(Object o) {
		return -1;
	}

	@Override
	public int lastIndexOf(Object o) {
		return -1;
	}

	@Override
	public ListIterator<I> listIterator() {
		return new ListIterator<I>() {

			@Override
			public boolean hasNext() {
				return false;
			}

			@Override
			public I next() {
				return null;
			}

			@Override
			public boolean hasPrevious() {
				return false;
			}

			@Override
			public I previous() {
				return null;
			}

			@Override
			public int nextIndex() {
				return -1;
			}

			@Override
			public int previousIndex() {
				return -1;
			}

			@Override
			public void remove() {
			}

			@Override
			public void set(I e) {
			}

			@Override
			public void add(I e) {
			}
		};
	}

	@Override
	public ListIterator<I> listIterator(int index) {
		return this.listIterator();
	}

	@Override
	public List<I> subList(int fromIndex, int toIndex) {
		return new EmptyList<I>();
	}

	public static <I> EmptyList<I> make() {
		return new EmptyList<I>();
	}

	@Override
	public void forEach(Consumer<? super I> action) {
	}

	@Override
	public void replaceAll(UnaryOperator<I> operator) {
	}

	@Override
	public boolean removeIf(Predicate<? super I> filter) {
		return false;
	}

	@Override
	public Stream<I> parallelStream() {
		return Stream.empty();
	}

	@Override
	public Stream<I> stream() {
		return Stream.empty();
	}

	@Override
	public Spliterator<I> spliterator() {
		return new Spliterator<I>() {

			@Override
			public boolean tryAdvance(Consumer<? super I> action) {
				return false;
			}

			@Override
			public Spliterator<I> trySplit() {
				return this;
			}

			@Override
			public long estimateSize() {
				return 0;
			}

			@Override
			public int characteristics() {
				return 0;
			}

		};
	}

	@Override
	public void sort(Comparator<? super I> c) {
	}
}
